package panel.getMore
{
	import assists.HtmlText;
	import assists.Lang;
	import assists.TextFieldUtils;
	import assists.URI;
	import assists.resource.ResourceLoader;
	
	import flash.display.Bitmap;
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.text.TextField;
	
	public class GetMoreInfoBox extends Sprite
	{
		private var _stage:Stage;
		private var _loader:ResourceLoader;
		private var _lang:Lang;
		private var _uri:URI;
		
		private var back:Bitmap;
		private var titleText:TextField;
		private var backContainer:Sprite;
		
		public var info:Object;
		
		public function GetMoreInfoBox(stage:Stage, loader:ResourceLoader, lang:Lang, uri:URI=null)
		{
			_stage = stage;
			_loader = loader;
			_lang = lang;
			_uri = uri;
			
			initThis();
		}
		
		private function initThis():void
		{
			titleText = new TextField;
			titleText.mouseEnabled = true;
			titleText.selectable = false;
			titleText.wordWrap = false;
			titleText.multiline = false;
			
			back = new _loader.uiManager.componentBack as Bitmap;
			reSize();
			
			backContainer = new Sprite;
			this.addChild(backContainer);
			backContainer.addChild(back);
			this.addChild(titleText);
		}
		
		private function reSize():void
		{
			back.width = _stage.stageWidth;
			back.height = _stage.stageHeight * .15;
		}
		
		public function changeData(obj:Object):void
		{
			info = obj;
			
			TextFieldUtils.setHtmlText(titleText,HtmlText.formatSizeColor("<b>" + obj.name + "</b>",0x000000,20));
			titleText.width = titleText.textWidth + 5;
			titleText.height = titleText.textHeight + 5;
			
			titleText.x = (_stage.stageWidth - titleText.width) / 2;
			titleText.y = (_stage.stageHeight * .15 - titleText.height) / 2;
		}
		
		public function clear():void
		{
			if(_stage){
				_stage = null;
				_loader = null;
				_lang = null;
				_uri = null;
				
				titleText = null;
				back = null;
			}
		}
	}
}